Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(connect): add initial support for connect component #2280

Merged
merged 33 commits into from
Nov 29, 2023

Conversation

cgdibble
Copy link
Contributor

@cgdibble cgdibble commented Nov 28, 2023

Description

The initial component for Connect to be available on the PPCP SDK. Still in development and gated at the Connect Portal layer.

Why are we making these changes? Include references to any related Jira tasks or GitHub Issues

Ticket DTPPCPSDK-1367 for a variety of work.

Dependent Changes (if applicable)

Groups who should review (if applicable)

❤️ Thank you!

Copy link

codecov bot commented Nov 28, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (6caee02) 51.01% compared to head (43d79d3) 51.18%.
Report is 5 commits behind head on main.

Files Patch % Lines
src/zoid/venmo/component.jsx 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2280      +/-   ##
==========================================
+ Coverage   51.01%   51.18%   +0.16%     
==========================================
  Files         104      104              
  Lines        2025     2032       +7     
  Branches      599      601       +2     
==========================================
+ Hits         1033     1040       +7     
  Misses        889      889              
  Partials      103      103              
Flag Coverage Δ
jest 31.99% <ø> (ø)
karma 49.87% <83.33%> (+0.21%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@jshawl jshawl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍 this has given me a ton of inspiration for the HostedButtons component! Nice job, y'all!

}

try {
const connect = await window.braintree.connect.create({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember one issue where I was unable to rely on window.braintree because the npm module (if npm-installed) did not attach itself to the window object - just mentioning it in case the integration pattern should support npm install braintree-web

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're ok here because the AXO module we load above is what will append that window object.

getLogger,
} from "@paypal/sdk-client/src";

const sendCountMetric = ({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm totally going to copy this for a different component! <- would it make sense to put sendCountMetric in a shared util file somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jshawl yes! @siddy2181 is actually working on that and moving it to sdk-client. It's used in SPB a bunch, and we want it here. We copied it over as we navigate the timeline dance, but the intent is to use a shared util of sendCountMetric from sdk-client.

});
} catch (error) {
sendCountMetric({
name: "pp.app.paypal_sdk.connect.init.error.count",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be pp.app.paypal_sdk.connect.load.error.count ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are keeping all errors under the same event name. Which then will be funneled based on loadvs create based on the event dimension param

});

sendCountMetric({
name: "pp.app.paypal_sdk.connect.init.success.count",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you follow a guideline for this name? (I'm about to do the same with another component but want to standardize with what you've done here!)

Copy link
Contributor Author

@cgdibble cgdibble Nov 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jshawl we referenced the card-fields stuff we'd done before but otherwise no we didn't know of a guide. Does one exist?

try {
loadResult = await loadAxo({
platform: "PPCP",
btSdkVersion: "3.97.3-connect-alpha.6.1",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So far this has to stay hardcoded. More to come, though.

@cgdibble cgdibble marked this pull request as ready for review November 28, 2023 18:59
@cgdibble cgdibble requested a review from a team as a code owner November 28, 2023 18:59
package.json Outdated Show resolved Hide resolved
Co-authored-by: elizabethmv <[email protected]>
errorName: "connect_init_error",
},
});
throw new Error(error);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should also log these errors log.error() so that we can investigate them in the future. I don't think we need logs for anything else, the metrics will be enough for the init and success cases. We'd want to see the errors themselves in cal though if theres an issue

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wsbrunson done!

dist/button.js Outdated
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh whyyy. I'm going to remove these, I'm not ok with incorporating other changes like this for this scenario.

src/connect/component.jsx Outdated Show resolved Hide resolved
Copy link
Contributor

@nbierdeman nbierdeman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

Comment on lines +21 to +22
const cmid = getClientMetadataID();
const clientID = getClientID();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these be camel case? I don't know anymore when it comes to "id".

Suggested change
const cmid = getClientMetadataID();
const clientID = getClientID();
const cmId = getClientMetadataID();
const clientId = getClientID();

@cgdibble cgdibble merged commit fcc0f44 into main Nov 29, 2023
3 checks passed
@cgdibble cgdibble deleted the feature/axo-on-ppcp branch November 29, 2023 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants